package com.yuexunit.finance.system.service;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.yuexunit.finance.system.entity.LoansMoneyRecordInfoEntity;
import com.yuexunit.inject.annotation.Implements;
import com.yuexunit.page.PageCriteria;
import com.yuexunit.page.PageList;
import com.yuexunit.persist.PersistUtil;
import com.yuexunit.persist.annotation.Transactional;

/**
 * @author wenwenlong
 */

@Implements(LoansMoneyRecordService.class)
public class LoansMoneyRecordServiceImpl implements LoansMoneyRecordService {
	@Override
	@Transactional
	public Long createLoansMoneyRecord(LoansMoneyRecordInfoEntity entity) {
		PersistUtil.insert(entity);
		return entity.getLonasMoneyId();
	}

	@Override
	public PageList<LoansMoneyRecordInfoEntity> inquireLoansMoneyReordPageList(Long lonasMoneyId, PageCriteria page) {
		DetachedCriteria criteria = DetachedCriteria.forClass(LoansMoneyRecordInfoEntity.class);
		criteria.add(Restrictions.eq("lonasMoneyId", lonasMoneyId));
		return PersistUtil.get(criteria, page);
	}
}
